package section3;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class PracticeVI {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line;
		int[] iarr;
		int i;
		List<Integer> list;
		while(sc.hasNext()){
			line = sc.next();
			String[] nums = line.split("5");
			list = new ArrayList<Integer>();
			for(i=0; i<nums.length; i++){
				if(!"".equals(nums[i])){
					list.add(Integer.parseInt(nums[i]));
				}
			}
			Collections.sort(list);
			for(i=0; i<list.size(); i++){
				if(i==list.size()-1){
					System.out.println(list.get(i));
				}else{
					System.out.print(list.get(i)+" ");
				}
			}
		}
	}
}
/*
排序
Sample Input
0051231232050775

Sample Output
0 77 12312320
对于输入的字符串，如果5在字符串的头部，会产生一个空串；
对于5在字符串的末尾则不考虑;
 * */






